import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'root',
      component: () => import('@/views/Root.vue'),
      redirect: 'recommendation',
      meta: {
        permission: [
          {
            id: 'orderlist_reminders',
            name: '催单',
            cId: '2dafb8cc-89c4-4e26-9c01-2119b9d8ed22',
            authorised: true,
            parentId: null,
            children: false,
          },
          {
            id: 'orderlist_replace_isOperate',
            name: '是否运营',
            cId: '3f326d23-7ff2-41c3-81b5-448c4311cf85',
            authorised: true,
            parentId: null,
            children: false,
          },
        ],
      },
      children: [
        {
          path: 'search-index',
          name: 'searchIndex',
          component: () => import('@/views/search/SearchIndex.vue'),
        },
        {
          path: 'recommendation',
          name: 'recommendation',
          component: () => import('@/views/recommendation/Index.vue'),
        },
        {
          path: 'exclusivePlaylist',
          name: 'exclusivePlaylist',
          component: () => import('@/views/exclusive-playlist/Index.vue'),
        },
        {
          path: 'music-hub',
          name: 'musicHub',
          component: () => import('@/views/music-hub/Index.vue'),
          redirect: 'music-hub/selected',
          children: [
            {
              path: 'selected',
              name: 'selected',
              component: () => import('@/views/music-hub/component/Selected.vue'),
            },
            {
              path: 'ranking',
              name: 'ranking',
              component: () => import('@/views/music-hub/ranking/Ranking.vue'),
            },
            {
              path: 'artist',
              name: 'artist',
              component: () => import('@/views/music-hub/artist/Index.vue'),
            },
            {
              path: 'playlist',
              name: 'playlist',
              component: () => import('@/views/music-hub/playlist/Index.vue'),
            },
          ],
        },
        {
          path: 'artist-info',
          name: 'artistInfo',
          component: () => import('@/views/music-hub/artist/desc/Index.vue'),
        },
        {
          path: 'album',
          name: 'album',
          component: () => import('@/views/album/Index.vue'),
        },
        {
          path: 'mv',
          name: 'mv',
          component: () => import('@/views/mv/Index.vue'),
        },
      ],
    },
  ],
})

export default router
